package com.hexiaohe.springboot_vue_app.service.impl;

import com.hexiaohe.springboot_vue_app.entity.UserRole;
import com.hexiaohe.springboot_vue_app.mapper.UserRoleMapper;
import com.hexiaohe.springboot_vue_app.service.UserRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserRoleServiceImpl implements UserRoleService {
    @Autowired
    UserRoleMapper userRoleMapper;
    @Override
    public boolean findByUserId(int user_id) {
        UserRole userRole = userRoleMapper.selectRoleByUserId(user_id);
        if (userRole==null){
            return false;
        }else {
            return true;
        }
    }

    @Override
    public int addUserRole(UserRole userRole) {
        return userRoleMapper.insert(userRole);
    }

    @Override
    public int UpdateUserRole(UserRole userRole) {
        return userRoleMapper.UpdateUserRole(userRole);
    }

    @Override
    public int deleteUserById(int userId) {
        return userRoleMapper.deleteUserById(userId);
    }
}
